package cn.itsource.user.controller;

import cn.itsource.basic.utils.AjaxResult;
import cn.itsource.user.domain.dto.LoginInfoDto;
import cn.itsource.user.service.ILogininfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LogininfoController {

    @Autowired
    private ILogininfoService logininfoService;

    @PostMapping("/login")
    public AjaxResult login(@RequestBody LoginInfoDto loginInfoDto){
        try {
            return logininfoService.login(loginInfoDto);
        } catch (Exception e) {
            e.printStackTrace();
            return new AjaxResult(e.getMessage());
        }
    }
}
